<template>
  <ul class="todo-list">
    <!-- completed: 完成的类名 -->
    <li
    :class="{completed:item.completed}"
    v-for="(item,index) in todos"
    :key="index"
    >
      <div class="view">
        <input class="toggle" type="checkbox" v-model="item.completed"/>
        <label>{{item.title}}</label>
        <button class="destroy" @click="onDel(item.id)"></button>
      </div>
    </li>
  </ul>

</template>

<script>
export default {
  props: ['todos'],
  methods: {
    onDel (val) {
      this.$emit('on-del', val)
    }
  }
}
</script>
